//
//  Connector.m
//  CocoaSynth
//
//  Created by Jérémy Brault on 09/02/10.
//  Copyright 2010 None. All rights reserved.
//

#import "Connector.h"
#import "PortOutProtocol.h"
#import "PortInProtocol.h"

@implementation Connector

#pragma mark -
#pragma mark Accessors

@synthesize portOut;
@synthesize portIn;

#pragma mark -
#pragma mark Memory Management

- (id)init
{
	if (self = [super init]) {
		portOut = nil;
		portIn = nil;
	}
	
	return self;
}

- (void)dealloc
{
	[portOut release];
	portOut = nil;
	[portIn release];
	portIn = nil;
	[super dealloc];
}
	
#pragma mark -
#pragma mark ConnectorProtocol

- (id<SampleProtocol>)getSample
{
	return [portOut outputSample];
}

- (BOOL)isConnected
{
	BOOL result = YES;
	if (portIn == nil) {
		result = NO;
	}
	if (portOut == nil) {
		result = NO;
	}
	return result;
}

@end
